

<div class="theme-editor" style="display:none">
    <form method="post" id="theme_form" action="<?php echo url('circle/theme/save_theme').'?c_id='.$c_id;?>">
        <input type="hidden" name="form_submit" value="ok" />
        <div class="quick-thread">
            <div class="quick-thread-box">
                <div class="title">
                    <label class="mr10"><span class="t">类型：</span><span class="i">
            <select name="thtype" class="select">
                <option value="0">默认</option>
                <?php if(!empty($thclass_list)){?>
                <?php foreach(($thclass_list) as $val){?>
                <?php if($super || in_array($identity, array(1,2))){?>
                <option value="<?php echo $val['thclass_id'];?>"><?php echo $val['thclass_name'];?></option>
                <?php }else if($val['is_moderator'] == 0){?>
                <option value="<?php echo $val['thclass_id'];?>"><?php echo $val['thclass_name'];?></option>
                <?php }?>
                <?php }?>
                <?php }?>
            </select>
            </span></label>
                    <label><span class="t">标题：</span><span class="i">
            <input name="name" type="text" class="text" />
            </span></label>
                </div>
                <?php echo showEditor('themecontent',$themecontent,'806px','400px','visibility:hidden;',"true",$editor_multimedia,'simple');?>
                <div class="bottom"> <a class="submit-btn" nctype="theme_submit" href="Javascript:void(0)">发布新话题</a> <a class="cancel-btn" nctype="theme_cancle" href="Javascript:void(0)">取消</a>
                    <div id="warning"></div>
                </div>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript" src="__SITE_RESOURCE__/js/fileupload/jquery.iframe-transport.js" charset="utf-8"></script>
<script type="text/javascript" src="__SITE_RESOURCE__/js/fileupload/jquery.ui.widget.js" charset="utf-8"></script>
<script type="text/javascript" src="__SITE_RESOURCE__/js/fileupload/jquery.fileupload.js" charset="utf-8"></script>
<script type="text/javascript" src="__SITE_RESOURCE__/js/jquery.validation.min.js"></script>
<script type="text/javascript" src="__SITE_RESOURCE__/js/jquery.mousewheel.js"></script>
<script type="text/javascript" src="__CIRCLE_RESOURCE__/js/miniditor/jquery.insertsome.min.js"></script>
<script type="text/javascript" src="__CIRCLE_RESOURCE__/js/miniditor/ubb.insert.js" charset="utf-8"></script>
<script type="text/javascript">
    var c_id = <?php echo $c_id;?>;
    $(function(){
        $('.theme-editor').ncUBB({
            c_id :c_id,
            UBBContent :$('#themecontent'),
            UBBSubmit :$('a[nctype="theme_submit"]'),
            UBBform :$('#theme_form'),
            UBBfileuploadurl :"<?php echo url('circle/theme/image_upload');?>?c_id="+c_id,
            UBBcontentleast :<?php echo intval(sysconf('circle_contentleast'));?>
	});
	//自定义滚定条
	$('#scrollbar').perfectScrollbar();
	// 表单验证
    $('#theme_form').validate({
        errorLabelContainer:$('#warning'),
        invalidHandler:function(form, validator) {
               $('#warning').show();
        },
    	submitHandler:function(form){
    		ajaxpost('theme_form', "<?php echo url('/circle/theme/save_theme');?>?c_id="+c_id, '', 'onerror');
    	},
        rules :{
        	name :{
                required :true,
                minlength :4,
            	maxlength :30
            },
            themecontent :{
                required :true
                <?php if(intval(sysconf('circle_contentleast')) > 0){?>
                ,minlength :<?php echo intval(sysconf('circle_contentleast'));?>
                <?php }?>
            }
        },
        messages :{
        	name :{
                required :'请填写标题',
        minlength :'标题在4到30字符之间',
        maxlength :'标题在4到30字符之间'
        },
        themecontent  :{
            required :"请填写内容"
            <?php if(intval(sysconf('circle_contentleast')) > 0){?>
            ,minlength :"<?php printf('内容不能少于%d个字符', intval(sysconf('circle_contentleast')));?>"
            <?php }?>
        }
        }
        });

        // 点击取消发话题
        $('a[nctype="theme_cancle"]').click(function(){
            $('.theme-editor').fadeOut('slow',function(){
                $('.thread-layer').fadeIn('fast');
            });
        });
        });
</script>
